global lingobj, girlobjlist, getlinggirlnum, trylingcount
on birth me, lh, lv, sanum
set snum to sanum
set cnum to the number of cast "ling"
set the puppet of sprite snum to 1
set the type of sprite snum to 1
set the castNum of sprite snum to cnum
set the ink of sprite snum to 36
set the foreColor of sprite snum to 255
set the backColor of sprite snum to 0
set the locH of sprite snum to lh
set the locV of sprite snum to lv
set flymode to 0
set flyhspeed to 0
set flystep to 0
return me
end
on lingmove me
set lh to the mouseH
set lv to the mouseV
if lh > 158 then
set lh to 158
end if
if lh < 0 then
set lh to 0
end if
if lv < 10 then
set lv to 10
end if
if lv > 310 then
set lv to 310
end if
set lastlh to lh
set lastlv to lv
set the locH of sprite snum to lh
set the locV of sprite snum to lv
end
on setlingflymode me
if flymode then
exit
end if
set flymode to 1
set flyhspeed to (the mouseH - lastlh) / 2.20000000000000018
if flyhspeed < 4 then
set flyhspeed to 4
end if
set flystep to 0
puppetSound("fall")
end
on flyling me
set lh to integer(the locH of sprite snum + flyhspeed)
set lv to lastlv + integer(power(flystep - 8, 2) * 0.29999999999999999) - 20
set the locH of sprite snum to lh
set the locV of sprite snum to lv
repeat with l = 1 to count(girlobjlist)
set gsnum to the snum of getAt(girlobjlist, l)
if inside(the loc of sprite snum, rect(the locH of sprite gsnum - 20, the top of sprite gsnum, the locH of sprite gsnum + 20, the top of sprite gsnum + 30)) then